package com.hmall.controller;

import com.hdmall.business.common.common.ServerResponse;
import com.hmall.service.QuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName QuestionController
 * @Description //TODO
 * @Author zhoutao
 * @Date 2019/1/28 8:56
 * @Version 2.0
 **/
@RestController
@RequestMapping("/question")
@Api(value = "问卷模块", description = "问卷API接口")
public class QuestionController {

    @Autowired
    QuestionService questionService;

    /**
     * @Date 2019/1/28 13:33
     * @Param []
     * @return com.hmall.common.ServerResponse
     * @Description 返回随机题目5道单选5道多选
     */
    @GetMapping("getQuestion")
    @ApiOperation(value = "得到问卷题目")
    public ServerResponse getQuestion(){

        return questionService.getQuestion();
    }


    /**
     * @Date 2019/1/28 14:07
     * @Param [userId, json]
     * @return com.hmall.common.ServerResponse
     * @Description 根据userId和json字符串返回成绩
     */
    @PostMapping("postQuestion")
    @ApiOperation(value = "提交问题", notes = "根据提交的JSON字符串返回对应的答案")
    public ServerResponse getRemark(int userId, String json){

        return questionService.postQuestion(userId, json);
    }

}
